package com.controller.information;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.po.ThumbsUpInfo;
import com.service.information.ThumbsUpService;

@Controller
@RequestMapping("/jsp/information")
public class ThumbsUpController {
	@Resource(name="thumbsUpServiceImp")
    private ThumbsUpService thumbsUpService;
	@ResponseBody
	@RequestMapping(value="/addThumbsUp")
	public int addThumbsUp(ThumbsUpInfo thumbsUpInfo, HttpServletRequest request, HttpServletResponse resp){
		String user = request.getSession().getAttribute("user_id").toString();
		thumbsUpInfo.setUser_id(user);
		int i=thumbsUpService.addThumbsUp(thumbsUpInfo);
		return i;
	}
	@ResponseBody
	@RequestMapping(value="/deleteThumbsUp")
	public int deleteThumbsUp(ThumbsUpInfo thumbsUpInfo, HttpServletRequest request, HttpServletResponse resp){
		String user = request.getSession().getAttribute("user_id").toString();
		thumbsUpInfo.setUser_id(user);
		int i=thumbsUpService.deleteThumbsUp(thumbsUpInfo);
		return i;
	}
}
